#include "stdafx.h"
#include "RecordErrorSet.h"
#include <sstream>

#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif

namespace serika
{
	namespace db
	{
		RecordErrorSet::RecordErrorSet()
		{
		}
	
		RecordErrorSet::~RecordErrorSet()
		{
		}
	
		void RecordErrorSet::Add(const std::string& message)
		{
			mMessages.push_back(message);
		}
	
		bool RecordErrorSet::IsEmpty() const
		{
			return mMessages.empty();
		}
	
		void RecordErrorSet::Clear()
		{
			mMessages.clear();
		}
	
		std::string RecordErrorSet::JoinMessages(const std::string& splitter)
		{
			std::stringstream ss;
			for (std::vector<std::string>::iterator itr = mMessages.begin(); itr != mMessages.end(); ++itr)
			{
				if (itr != mMessages.begin())
				{
					ss << splitter;
				}
				ss << *itr;
			}
			return ss.str();
		}
	}
}
